import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import './plugins/element.js'
import Element from 'element-ui'
import ExTableColumn from 'ex-table-column';
//图表
import echarts from 'echarts'
import axios from './utils/axiosUtils'
Vue.prototype.$echarts = echarts
Vue.use(Element)
Vue.config.productionTip = false
Vue.prototype.$echarts = echarts
Vue.prototype.$axios = axios

// 全局路由守卫
router.beforeEach((to, from, next) => {
  let token = localStorage.getItem("token")//验证登录状态
  if (token) {//判断是否登录
    next()
  }
  else {
    if (to.path !== '/login') {
      alert("请先登录")
      next({ path: '/login' })
    }
    else {
      next()
    }
  }
})


new Vue({
  router,
  store,
  render: h => h(App)
}).$mount('#app')

